<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedTinyInteger('type')->default(0); //栏目类型，0频道栏目，1内容栏目
            $table->unsignedInteger('parent_id'); //父栏目ID
            $table->string('fullpath')->nullable(); //栏目全路径，用于无限级分类列表
            $table->unsignedTinyInteger('is_nav')->default(1); //是否显示在导航栏，0不显示，1显示
            $table->unsignedInteger('sort')->default(0); //栏目排序，由低到高（正序）
            $table->string('name'); //栏目名
            $table->string('thumbnail')->nullable(); //栏目缩略图（原图）
            $table->string('thumbnail_s')->nullable(); //栏目缩略图(原图0.5倍)
            $table->longText('content')->nullable(); //内容栏目的内容
            $table->string('route')->default('articleList'); //跳转路由
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('category');
    }
}
